home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / c / gmice.com / MOUSE.H < prev   
Encoding:
C/C++ Source or Header  |  1989-06-12  |  3.7 KB  |  114 lines

  1. /* $Header:   C:/SRC/MOUSE/PVCS/MOUSE.H_V   1.0   12 Jun 1989 21:29:08  $
  2.     Dwight N. Tovey (Adapted from the May/June 1988 issue of TURBO TECHNIX)
  3. ----------------------------------------------------------------------------
  4.  
  5. $Log:   C:/SRC/MOUSE/PVCS/MOUSE.H_V  $
  6.    
  7.       Rev 1.0   12 Jun 1989 21:29:08
  8.    Initial revision.
  9. */
  10.  
  11. #ifndef    MOUSE_H
  12. #define    MOUSE_H
  13.  
  14. #include    <dos.h>
  15.  
  16. /* Define sorting macros used locally */
  17. #define lower( x, y )  (x < y) ? x : y
  18. #define upper( x, y )  (x > y) ? x : y
  19.  
  20. /* BUTTON DEFINITIONS */
  21. #ifndef  LEFT
  22. #define  LEFT  0
  23. #define  RIGHT 1
  24. #endif
  25.  
  26. /* STRUCTURES USED BY THE MOUSE FUNCTIONS. */
  27. typedef struct {
  28.     int exists,                            /* TRUE if mouse is present */
  29.          nButtons;                        /* # of buttons on mouse */
  30. } resetRec;                                /* returned by mReset */
  31.  
  32. typedef struct {
  33.     int buttonStatus,                    /* bits 0-2 on if corresp button is down */
  34.          opCount,                        /* # times button has been clicked */
  35.          column, row;                    /* position */
  36. } LocRec;                                /* returned by mPos, mPressed, mReleased. */
  37.  
  38. typedef struct {
  39.     int hCount,                            /* Net horizontal movement. */
  40.          vCount;                            /* Net vertical movement. */
  41. } moveRec;                                /* Returned by mMotion */
  42. /*-------------------------------------------------------------------------*/
  43.  
  44. /* Prototypes for the MS mouse functions. */
  45.  
  46. resetRec *m_reset( void );
  47.     /* Resets mouse to default state.  Returns pointer to a structure 
  48.         indicating whether or not mouse is installed and, if so, how many 
  49.         buttons it has. 
  50.         Always call this function during program initialization. */
  51.  
  52. void m_show( void );
  53.     /* Makes the mouse cursor visible.  Don't call if cursor is already
  54.         visible, and alternate with calls to mHide. */
  55.  
  56. void m_hide( void );
  57.     /* Makes mouse cursor invisible.  Movement and button activity are stil
  58.         tracked.  Do not call if cursor is already hidden, and alternate with
  59.         calls to mShow. */
  60.  
  61. LocRec *m_pos( void );
  62.     /* Gets mouse cursor position and button status, returns pointer to
  63.         structure containing this info. */
  64.  
  65. void m_moveto( int, int );
  66.     /* Move mouse cursor to new position. */
  67.  
  68. LocRec *m_pressed( int );
  69.     /* Gets pressed info about named button: current status (up/down), times
  70.         pressed since last call, position at most recent press.  Resets count
  71.         and position info.  Button 0 is left, 1 is right.
  72.         Returns pointer to LocRec structure containing info. */
  73.  
  74. LocRec *m_released( int );
  75.     /* Same as mPressed, except gets released info about button. */
  76.  
  77. void m_col_range( int, int );
  78.     /* Sets min and max horizontal range for mouse cursor.  Moves cursor 
  79.         inside range if outside when called.  Swaps values if hmin and hmax
  80.         are reversed. */
  81.  
  82. void m_row_range( int, int );
  83.     /* Same as mColRange, except sets vertical boundaries. */
  84.  
  85. void m_graph_cursor( int, int, unsigned, unsigned );
  86.     /* Sets graphic cursor shape. */
  87.  
  88. void m_text_cursor( int, unsigned, unsigned );
  89.     /* Sets text cursor type, where 0 = software and 1 = hardware).
  90.         For software cursor, the two unsigned args are the screen and cursor
  91.         masks.
  92.         For hardware cursor, the two unsigned args specify scan line 
  93.         start/stop  i.e cursor shape. */
  94.  
  95. moveRec *m_motion( void );
  96.     /* Reports net motion of cursor since last call to this function. */
  97.  
  98. void m_inst_task( unsigned mask, unsigned taskSeg, unsigned taskOfs );
  99.     /* Installs a user-defined task to be executed upon one or more mouse
  100.         events specified by mask. */
  101.  
  102. void m_lpen_on( void );
  103.     /* Turns on light pen emulation.  This is the default condition. */
  104.  
  105. void m_lpen_off( void );
  106.     /* Turns off light pen emulation. */
  107.  
  108. void m_ratio( int, int );
  109.     /* Sets mickey-to-pixel ratio, where ratio is R/8. Default is 16 for
  110.         vertical, 8 for horizontal. */
  111.  
  112. #endif    /* MOUSE_H */
  113.  
  114.